#!/bin/bash

PORT=5210
PROJECT=holy
USER=ubuntu

DIR=/home/$USER/coding/paladin/$PROJECT
WORKERS=2
BIND=127.0.0.1:$PORT
DJANGO_SETTINGS_MODULE=$PROJECT.settings
DJANGO_WSGI_MODULE=$PROJECT.wsgi
LOG_LEVEL=info

cd $DIR

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE

exec poetry run gunicorn ${DJANGO_WSGI_MODULE} \
    --workers $WORKERS \
    --user=$USER \
    --bind=$BIND \
    --log-level $LOG_LEVEL\
    --access-logfile '-'\
    --access-logformat '[%(h)s] "%(r)s" %(s)s %(L)s "%(f)s"' \
    --reload \
    $*
